Subject: Re: Auto opening libraries by SAS/C
From: [email-masked] (Doug Walker)
Date: 15 Feb 93 14:39:37 GMT
Newsgroups: comp.sys.amiga.programmer

In article <[email-masked]>, [email-masked] (Bart Schraa) writes:
|> Hi,
|> 
|> How do I actually auto open a system library with SAS/C 6.2. I tried some things which were stated in the manual. I only should do this wouldn't I?
|> 
|> long oslibversion = 38L;
|> 
|> struct Library *DOSBase;
|> 
|> Then my program shouldn't run under V37, would it? I also tried the other one : 'long OSlibversion = 38L'. I linked all of these with c.o, but all attempts I did were running, but they really shouldn't.
|> 
|> Maybe there is someone with a solution? Doug?
|> 
|> Kind Regards, Bart.

Firstly, DOSBase is a special case.  It is autoopened by the STARTUP 
code, not by the autoinit code in the libraries.  The startup code
doesn't look at __oslibversion.  SysBase is the only other such
exception.

Secondly, NOTHING looks at oslibversion.  The non-DOSBase code
looks at __oslibversion, though.  The name is extremely important!

Thirdly, remember that if you want to autoinitialize a library
base, you cannot DEFINE it in your code, you can only DECLARE
it in your code.  Therefore, you need to say

   extern struct Library *IntuitionBase;

rather than

   struct Library *IntuitionBase;

to tell the compiler that you want IntuitionBase to be autoinitialized.

Fourthly, the best way to initialize these library bases is to simply
#include the appropriate header:

   #include <proto/intuition.h>

instead of trying to declare them in your own code.

-- 
  *****
=*|_o_o|\\=====Doug Walker, Software Distiller====== BBS: (919)460-7430 =
 *|. o.| ||                                          1200/2400/9600 Dual
  | o  |//     For all you do, this bug's for you!
  ====== 
usenet: [email-masked]                            bix: djwalker 
Any opinions expressed are mine, not those of SAS Institute, Inc.